﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data;
using System.Data.SqlClient;

namespace DBComparer.DataAccess
{
    class Databases
    {
        public DataSet GetDatabases(SqlConnection argConnection) 
        {
            SqlDataAdapter adp = new SqlDataAdapter("sp_databases", argConnection);

            DataSet ds = new DataSet();

            if (adp.SelectCommand.Connection.ConnectionString.Length>0)
                adp.Fill(ds);

            return ds;
        }

        public void Run(SqlConnection argConnection, string argCommand) 
        {

            SqlCommand cmd = new SqlCommand(argCommand, argConnection);

            cmd.Connection.Open();
            cmd.ExecuteNonQuery();
            cmd.Connection.Close();
        }
    }
}
